<!DOCTYPE html>
<head>
  <meta charset="utf-8">
<title>CSS Animations Test: animation-delay - positive value</title>
<style>
  div {
    animation-name: sample;
    animation-duration: 3s;
    animation-delay: 1s;

    background-color: blue;
    height: 100px;
    width: 100px;
    position: relative;
  }

  @keyframes sample {
    from {
      left: 150px;
    }
    to {
      left: 0px;
    }
  }
</style>
</head>
<body>
  <p>
    Test passes if there is a filled blue square with 'Filler Text',
    which starts moving from right to left after about 5 seconds
    from the time the page is loaded.
  </p>
  <div id="main">Filler Text</div>
</body>
<script>
  await sleep(0.2);
  const main = document.getElementById('main');
  expect(main.offsetLeft).toBe(0, 'start offset left should be zero.');

  await sleep(1);
  expect(main.offsetLeft <= 150 && main.offsetLeft > 100).toBe(true, `offsetLeft: ${main.offsetLeft}`);

  await sleep(3);
  expect(main.offsetLeft === 0).toBe(true, 'animation should be ended');
</script>
